<title>所有订单列表</title>
<link type="text/css" href="${ctx}/resources/css/ace.min.1.css"  rel="stylesheet" />
<table>
<tr>
<tr>
<th>订单状态 :</th>
<th width="70px;" class="label label-sm label-light arrowed"> <a href="${ctx}/admin/order/list${suffix}" >全部</a> </th>
<th width="70px;" class="label label-sm label-success arrowed"> <a href="${ctx}/admin/order/list${suffix}?state=1" >正常</a> </th>
<th width="70px;" class="label label-sm label-warning arrowed"> <a href="${ctx}/admin/order/list${suffix}?state=2" >禁用</a> </th>
</tr>
</table>
<div class="hr hr-5 dotted"></div>
<div class="row">
	<div class="col-xs-12">
		<div class="table-responsive">
			<table id="sample-table-1" class="table table-striped table-bordered table-hover">
				<thead>
					<tr>
						<th>ID</th>
						<th>订单名称</th>
						<th>用户id</th>
						<th>订单总额（元）</th>
						<th>支付渠道</th>
						<th>支付状态</th>
						<th>催单状态</th>
						<th>积分返利</th>
						<th>下单时间</th>
						<th>支付时间</th>
						<th>订单状态</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
				<#list pager.itemList as u>
					<tr>
						<td><span class="green center">${u.id}</span></td>
						<td>${u.name!}</td>
						<td>${u.userId}</td>
						<td>${u.price!}</td>
						<td>
							<span class="label label-sm label-warning arrowed">
									${dicSetting.getParameterValue("payChannel." + u.payChannel)!}
							</span>
						</td>
						<td>
							
							<span class="label label-sm label-warning arrowed">
								<#if u.status == 2>
									<a onclick="sendGoods('${u.id}')" title="配送">${dicSetting.getParameterValue("order.status." + u.status)!}	</a>
								<#else>
								${dicSetting.getParameterValue("order.status." + u.status)!}
								</#if>
							</span>
						</td>
						<td>
							<#if u.isRemind == 1>
							<span class="label label-sm label-warning success">
								未催单
							</span>
							<#else>
								<span class="label label-sm label-success success">
									已催单
								</span>
							</#if>
							
						</td>
						<td>
							${u.point!}
						</td>
						<td>
							<#if u.createTime??>
								${tagUtils.formatDate(u.createTime)!}
							</#if>
						</td>
						<td>
							<#if u.payTime??>
								${tagUtils.formatDate(u.modifyTime!)!}
							</#if>
						</td>
						<td>
						<#if u.state == 2>
							<input name="switch-field-1" class="ace ace-switch ace-switch-4" type="checkbox" onchange="doUserState(this,'${u.id}');" id="off_state"/>
							<span class="lbl"></span>
						<#else>
							<input name="switch-field-1" class="ace ace-switch ace-switch-4" type="checkbox" onchange="doUserState(this,'${u.id}');" checked="checked" id="off_state"/>
							<span class="lbl"></span>
						</#if>
							
						</td>
						<td>
						</td>
					</tr>
				</#list>
				</tbody>
			</table>
		</div><!-- /.table-responsive -->
		
		<div class="hr hr-18 dotted hr-double"></div>
		<@h.page pager=pager action="${ctx}/admin/order/list${suffix}" />
	</div><!-- /span -->
</div><!-- /row -->

<#if errorMsg??>
	<div class="hr hr-18 hr-double dotted"></div>
	<h4 class="lighter">
		<i class="icon-hand-right icon-animated-hand-pointer red"></i>
		<span class="pink">${errorMsg}</span>
	</h4>
</#if>

<#if infoMsg??>
	<div class="hr hr-18 hr-double dotted"></div>
	<h4 class="lighter">
		<i class="icon-hand-right icon-animated-hand-pointer green"></i>
		<span class="pink">${infoMsg}</span>
	</h4>
</#if>
<script>
	function isDel(url){
		if(!confirm("确认要删除？")){ 
				return false;		
		}else{
			location.href = url;
		}
	}
function doUserState(checkbox,id) {
		if(checkbox.checked) {
			$.ajax({
			async : false,
	        cache : false,
	        type : 'POST',
	        dataType :JSON,
	        url : "${ctx}/admin/order/on?id="+id,
	        error : function(data){
	        	var str = data.responseText;
	        	if(str.indexOf("true")>0){
    				location.href = location.href;
    			}else{
    			}
	        }
			});
		} else {
			$.ajax({
			async : false,
	        cache : false,
	        type : 'POST',
	        dataType :JSON,
	        url : "${ctx}/admin/order/off?id="+id,
	        error : function(data){
	        	var str = data.responseText;
	        	if(str.indexOf("true")>0){
    				location.href = location.href;
    			}else{
    			}
	        }
			});
		}
	}
$(document).ready(function(){
	RP.addBreadcrumb([ {name:"所有订单列表", active: true}]);
});
	function sendGoods(id){
		if(!confirm("确认已配送？")){ 
				return false;		
		}else{
			location.href = "${ctx}/admin/order/sendGoods?id="+id;
		}
	}
</script>